home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
DO1002.ARJ
/
WRITE.SCR
< prev
Wrap
Text File
|
1991-12-28
|
2KB
|
55 lines
.pg wi full clr cy
COMMAND NAME»gray«: »%t«WriteToFile»ye«
/WRITE {handle} ["]{line}[&]["]
/cw
The »%t«WriteToFile»#« command writes »cy«{line}»#« to the file which
has been opened for (»ye«W»#«)rite with the indicated »cy«{handle}»#«.
The file must have been opened by the »%t«/OPEN»#« command with a mode
of (»ye«W»#«)rite or (»ye«A»#«)ppend. If the file is not opened or opened
in (»re«R»#«)ead mode, the script will abort. »cy«{handle}»#« must be the
correct one for the opened file.
All variables in »cy«{line}»#« and »cy«{handle}»#« are expanded. Line must
be enclosed in double quotes if it contains the separator
character (»ye«<SPACE>»#«). If line ends in the ampersand ("»ye«&»#«") then
a carriage return and line feed will »+re«NOT»#« be added to the
line.
.pg clr
Here is an example. The commands are displayed before they
are executed. Press »bo«<enter>»#« to execute the commands.
First we'll open the file:
|/OPEN 1 OUTFILE.TXT W
Now we'll write a couple of lines to it:
|/WRITE 1 "This is the first line in the file."
»reset«Notice that the second line ends in an »ye«ampersand»#« ("»wh«&»#«"). After
you press »bo«<enter>»#« to execute the command, you will be
prompted for your first name. Because of the ampersand, your
name will be »gr«appended»#« to the end of this line.
|/WRITE 1 "This is the second line, &"
/SET Default NONE
/GETS Name Default " »wh«What is your first name»re«?»#«" 20
|/WRITE 1 %name.
|/WRITE 1 "The line above was constructed with two /WRITE statements."
|/CLOSE 1
.reset
Now we'll list the file with the »%t«/LIST»#« command.
|/LIST OUTFILE.TXT
/ERASE OUTFILE.TXT N
/GOTO WRITEEND
:OPENERROR
There was some error opening the file. We will not be able
to perform the demonstration.
:WRITEEND
/ENDEXEC